package com.thf.service.impl;

import com.thf.dao.impl.NavDaoImpl;
import com.thf.model.NavModels;
import com.thf.service.NavService;
import com.thf.util.FileDataUtil;

import java.io.IOException;

public class NavServiceImpl implements NavService {

    NavDaoImpl ndi =new NavDaoImpl();
    @Override
    public String[] getNavData(String inPath, String outPath, String pathName) {
        String filePath = ndi.createFileData(inPath,outPath,pathName);
        String[] fileData = null ;
        try {
            fileData = FileDataUtil.getFileData(filePath);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return fileData ;
    }

    @Override
    public NavModels setNavData() {
        NavModels navModels = new NavModels();
        String[] navData = getNavData("D:/test/navIndexData.txt", "D:\\huarui03\\web\\WEB-INF\\note", "navIndexData.txt");
        navModels.setIndexOne(navData[0]);
        navModels.setIndexTwo(navData[1]);
        navModels.setIndexThere(navData[2]);
        navModels.setIndexFour(navData[3]);
        navModels.setIndexFive(navData[4]);
        navModels.setIndexSix(navData[5]);
        navModels.setIndexSeven(navData[6]);
        navModels.setHrefOne(navData[7]);
        navModels.setHrefTwo(navData[8]);
        return navModels ;
    }
}
